package com.ndp.fb.rdb.model;

import com.ndp.fb.rdb.annotation.Column;
import com.ndp.fb.rdb.annotation.ColumnType;
import com.ndp.fb.rdb.annotation.Id;
import com.ndp.fb.rdb.annotation.NoSave;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

/**
 * AdGroup
 *
 * @author Administrator
 */
@Setter
@Getter
@NoArgsConstructor
public class AdGroup implements Serializable {

    /**
     * 描述   (@author: yanghao)
     */
    private static final long serialVersionUID = -7194088941785424506L;

    /**
     * id
     */
    @Id
    private Long id;

    /**
     * ad_group_id
     */
    private Long adGroupId;

    /**
     * campaign_group_id
     */
    private Long campaignGroupId;

    /**
     * fb_account_id
     */
    private Long fbAccountId;

    /**
     * fb_connection_object_id
     */
    private Long fbConnectionObjectId;

    /**
     * adSetId --campaignId
     */
    private Long adSetId;

    /**
     * publish_batch_id
     */
    private Long publishBatchId;

    /**
     * product_conf_id
     */
    private Long productConfId;

    /**
     * ad_creative_id
     */
    private Long adCreativeId;

    /**
     * name
     */
    private String name;

    /**
     * adgroup_status
     */
    @Column("adgroup_status")
    private String adGroupStatus;
    /**
     * effective_status
     */
    @Column(value = "effective_status",type = ColumnType.Varchar)
    private String effectiveStatus;

    /**
     * bid_type
     */
    private String bidType;

    /**
     * bid_info
     */
    private String bidInfo;

    /**
     * conversion_specs
     */
    private String conversionSpecs;

    /**
     * tracking_specs
     */
    private String trackingSpecs;

    /**
     * created_time
     */
    private Date createdTime;

    /**
     * updated_time
     */
    private Date updatedTime;

    /**
     * objective
     */
    private String objective;

    /**
     * updated_utc_time
     */
    private Long updatedUtcTime;

    /**
     * created_utc_time
     */
    private Long createdUtcTime;

    /**
     * name_status
     */
    private Integer nameStatus;

    /**
     * open_status
     */
    private Integer openStatus;

    /**
     * targeting
     */
    @Column(value = "targeting",type = ColumnType.Varchar)
    private String targeting;

    @NoSave
    private int isDelete;

    /**
     * failed_delivery_checks
     */
    @Column("failed_delivery_checks")
    private String failed_delivery_checks;

    /**
     * bid_amount
     */
    private Integer bidAmount;

    private Long ecTemplateMaterielId;


    @Override
    public int hashCode() {
        return adGroupId.hashCode();
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (obj instanceof AdGroup) {
            if (this.adGroupId != null && this.adGroupId.equals(((AdGroup) obj).getAdGroupId())) {
                if (this.updatedUtcTime != null && this.updatedUtcTime.equals(((AdGroup) obj).getUpdatedUtcTime())) {
                    if (this.adGroupStatus != null && this.adGroupStatus.equals(((AdGroup) obj).getAdGroupStatus())) {
                        return true;
                    }
                }

            }

        }
        return false;
    }

}
